package tests;
import common.Utils;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;

import java.io.IOException;
/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 10715
 * Date: 2024-08-23
 * Time: 22:00
 */
public class ListPage extends Utils {
    Class<?> targetclass = ListPage.class;
    public static String url = "http://192.168.47.135:8653/blog_system/blog_list.html";

    public ListPage() {
        super(url);
    }

    public void listByElement() {
        driver.navigate().refresh();
        String userName = "张三";
        String methodName = "";
        //标题
        driver.findElement(By.cssSelector("body > div.container > div.right > div:nth-child(1) > div.title"));
        assert  driver.findElement(By.cssSelector("body > div.container > div.left > div > h3")).getText().equals(userName);
        //截屏
        try {
            methodName = targetclass.getMethod("listByElement").getName();
            getScreenShot(targetclass.getName() + "-" + methodName);
        } catch (IOException | NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }
}